home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 152 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.3 KB

  1. From: thp@cs.ucr.edu (Tom Payne)
  2. Message-ID: <4ebptg$frt@galaxy.ucr.edu>
  3. X-Original-Date: 26 Jan 1996 23:59:44 GMT
  4. Path: in1.uu.net!bounce-back
  5. Date: 27 Jan 96 00:18:38 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Newsgroups: comp.std.c++
  8. Subject: Re: Throwing an exception from within a signal handler
  9. Organization: University of California, Riverside Department of Computer Science
  10. References: <4dgj4m$9la@engnews1.Eng.Sun.COM> <DLCosx.Hn1@falcon.daytonoh.attgis.com> <KANZE.96Jan19122409@gabi.gabi-soft.fr>
  11. X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
  12. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  13.     iQBFAgUBMQlvbuEDnX0m9pzZAQHb5AGAghDJiPEsPYWBFjVeTb3GC7yeGfkTYZdZ
  14.     9XS99LqzLtmCwxuxk7wFiws+b7ItJZSU
  15.     =k+7T
  16.  
  17. J. Kanze (kanze@gabi.gabi-soft.fr) wrote:
  18. : In article <DLCosx.Hn1@falcon.daytonoh.attgis.com> Dick Menninger
  19. : <Dick.Menninger@daytonoh.attgis.com> writes:
  20. : > > ==========Steve Clamage, 1/16/96==========
  21. : > > In C, a signal handler isn't allowed to do much of anything, precisely
  22. : > > because the program state can't be known and may be inconsistent. The
  23. : > > same is true in C++.
  24. : > It is just like an interrupt handler in that it could
  25. : > deadlock with the code it preempts.  OSes deal with
  26. : > that and do quite meaty stuff in the interrupt handlers.
  27. [...]
  28. : From ISO 9899, section 7.7.1.1: ``If the signal occurs other than as the
  29. : result of calling the abort or raise function, the behavior is undefined
  30. : if the signal handler calls any function in the standard library other
  31. : than the signal function itself (with a first argument of the signal
  32. : number corresponding to the signal tha caused the invocation of the
  33. : handler) or refers to any object with static storage duration other than
  34. : by assigning a value to a static storage duration variable of type
  35. : volatile sig_atomic_t.''
  36. [...]
  37.  
  38. In other words, the only asynchronous activity allowed to programs
  39. with defined behavior is polling volatile atomic variables that are
  40. set by signal handlers.  Thus far, no one has given me a reason for
  41. prohibiting signal handlers from reading volatile atomic variables,
  42. which is a common practice in interrupt handlers (even those written
  43. in C/C++).
  44.  
  45. Tom Payne (thp@cs.ucr.edu)
  46. ---
  47. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  48.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  49.   is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
  50.